package com.taobao.top.converter
{
	import com.taobao.top.model.Location;
	import com.taobao.top.model.Shipping;
	import com.taobao.top.TOPUtil;
	
	public class ShippingConverter
	{
		public function ShippingConverter()
		{
		}

		public static function convert(shippingObj:Object):Shipping
		{
			var shipping:Shipping = new Shipping();
			shipping.buyer_nick = shippingObj.buyer_nick;
			shipping.company_name = shippingObj.company_name;
			
			shipping.delivery_end = TOPUtil.getCustomDate(shippingObj.buyer_nick);
			shipping.delivery_start = TOPUtil.getCustomDate(shippingObj.buyer_nick);
			
			shipping.freight_payer = shippingObj.freight_payer;
			shipping.item_title = shippingObj.item_title;
			shipping.out_sid = shippingObj.out_sid;
			if(shippingObj.receiver_location!=null)
			{
				var receiver_location:Location = new Location();
				receiver_location.address = shippingObj.receiver_location.address;
				receiver_location.city = shippingObj.receiver_location.city;
				receiver_location.country = shippingObj.receiver_location.country;
				receiver_location.district = shippingObj.receiver_location.district;
				receiver_location.state = shippingObj.receiver_location.state;
				receiver_location.zip = shippingObj.receiver_location.zip;
				shipping.receiver_location = receiver_location;
			}
			shipping.receiver_mobile = shippingObj.receiver_mobile;
			shipping.receiver_name = shippingObj.receiver_name;
			shipping.receiver_phone = shippingObj.receiver_phone;
			shipping.seller_confirm = shippingObj.seller_confirm;
			shipping.seller_nick = shippingObj.seller_nick;
			shipping.status = shippingObj.status;
			shipping.tid = shippingObj.tid;
			shipping.type = shippingObj.type;
		}
	}
}